import * as index from '@/api/index.js'
export default {
	data() {
		return {}
	},
	onLoad() {

	},
	methods: {
		getuserinfo() {
			var _this = this
			wx.getUserProfile({
				desc: '用户完善个人信息',
				success: (userInfo) => {
					console.log(userInfo, 'userInfouserInfouserInfouserInfo')
					wx.login({
						success(loginCode) {
							console.log(loginCode, 'loginCodeloginCodeloginCode')
							index.login({
								code: loginCode.code,
								// gender: userInfo.userInfo.avatarUrl,
							}).then(res => {
								console.log("res登录", res)
								uni.setStorageSync('token', res.token)
								uni.setStorageSync('userinfo', res.user)
								uni.reLaunch({
									url:'/pages/home/index'
								})
							})
						}
					})
				},
				fail: () => {
					wx.showToast({
						title: '授权失败',
						icon: 'error',
						duration: 2000
					})
				}
			})
		},
	}
}